package com.sunjs.wechat.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.sunjs.model.LyOrder;
import com.sunjs.model.back.RestCode;
import com.sunjs.model.back.RestResponse;
import com.sunjs.wechat.service.WxOrderService;


@RestController
@RequestMapping(value = "/wx/Order")
public class WxOrderController {
	
	@Autowired
	private WxOrderService  wxOrderService;
	
	//	全部订单
	@RequestMapping(value = "/selectOrders", method = RequestMethod.POST)
	public RestResponse<List<LyOrder>> select(@RequestBody LyOrder lyOrder) {
		try {
			List<LyOrder> LyOrderList = wxOrderService.selectOrderList(lyOrder);
			return  RestResponse.success(LyOrderList);
		} catch (Exception e) {
			return RestResponse.error(RestCode.FAIL);
		}
	}
	
	// 订单详情
    @RequestMapping(value = "/orderDetails", method = RequestMethod.POST)
    public RestResponse<LyOrder> selectById(@RequestBody LyOrder lyOrder) {
        try {
            LyOrder LyOrder = wxOrderService.selectOrderById(lyOrder);
            return  RestResponse.success(LyOrder);
        } catch (Exception e) {
            return RestResponse.error(RestCode.FAIL);
        }
    }
	
	
	
}


